var uiOperat = require('./uiOperat.js');
export const dateByCloud = (options)=>{	
	return new Promise((resolve,reject)=>{
		
		let notShowLoading = options.notShowLoading || false ;		
		if(!notShowLoading)uiOperat.showLoading('加载中...');
		uniCloud.callFunction({
			name: options.name,
			data: options.data,
			success:function(res){
				if(!notShowLoading)uiOperat.hideLoading();
				// let title = '网络繁忙请重试';
				// title = res.data.msg || '';//以云端返回的显示
				// if(title !== ''){
				// 	return uni.showToast({
				// 		title : title ,
				// 		duration:2000,
				// 		icon:'none'
				// 	})
				// }
				resolve(res)
			},
			fail:function(err){
				console.log('err',err)
				if(!notShowLoading)uiOperat.hideLoading();
				return uni.showToast({
					title:'网络繁忙请刷新',
					duration:2000,
					icon:'none'
				})	
				reject(err)
			}
		})
		
	})
}